package web.ajax02;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
import java.io.IOException;

/**
 * Created by IntelliJ IDEA.
 * User: jqbxd
 * Date: 2009-4-9
 * Time: 16:26:38
 * To change this template use File | Settings | File Templates.
 */
public class AutoCompleteServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
                   doGet(request, response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            //表示页面穿过来的字符串，用于服务器端的单词进行完整匹配
            String word=request.getParameter("word");
        //将字符串保存在request对象中
        request.setAttribute("word",word);
        //将请求转发给视图层(注意ajax中，这个所谓的视图层不返回页面，只返回数据，所以也可以称作是一个数据层)
        request.getRequestDispatcher("wordxml.jsp").forward(request,response);
        
    }
}



























